package com.wang.system.controller;

import com.wang.common.core.controller.BaseController;
import com.wang.common.core.domain.R;
import com.wang.common.core.domain.TableDataInfo;
import com.wang.system.domain.user.dto.UserDTO;
import com.wang.system.domain.user.dto.UserQueryDTO;
import com.wang.system.service.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "C端用户管理接口")
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @Operation(summary = "查询用户列表")
    @GetMapping("/list")
    public TableDataInfo list(UserQueryDTO userQueryDTO){
        return BaseController.getTableDataInfo(userService.list(userQueryDTO));
    }

    @Operation(summary = "修改用户状态 (正常/拉黑)")
    @PutMapping("/updateStatus")
    public R<Void> updateStatus(@RequestBody UserDTO userDTO){
        return BaseController.toR(userService.updateStatus(userDTO));
    }
}
